﻿using Basic.HrGatewayModular.Interface;
using Basic.HrGatewayModular.Model.EmpFile;
using Basic.HrRemoteModel.EmpFile.Model;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;

namespace Basic.HrGatewayModular.Api
{
    internal class EmpFileApi : ApiController
    {
        private readonly IEmpSelfFileService _Service;

        public EmpFileApi ( IEmpSelfFileService service )
        {
            this._Service = service;
        }

        public long Add ( EmpFileAdd add )
        {
            return this._Service.Add(base.UserState.ToEmpId(), add);
        }

        public void Delete ( [NumValidate("hr.file.id.error", 1)] long id )
        {
            this._Service.Delete(id);
        }
        public EmpFileDto FindLast ( [NullValidate("hr.file.classify.error")] string classtify )
        {
            return this._Service.FindLast(base.UserState.ToEmpId(), classtify);
        }

        public EmpFileDto[] Gets ( [NullValidate("hr.file.classify.error")] string classtify )
        {
            return this._Service.Gets(base.UserState.ToEmpId(), classtify);
        }
    }
}
